package game.players.goalkeeper.mate;

import game.players.SoccerPlayer;
import game.players.goalkeeper.GoalkeeperState;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.appearances.Animation;
import com.uqbar.vainilla.appearances.Sprite;

public class WalkingToTheRightMate extends GoalkeeperState {
	
	public WalkingToTheRightMate(SoccerPlayer player) {
		super(player);
		player.setAppearance(new Animation(0.3,
				Sprite.fromImage("/images/arquero_arco.png").crop(21,11,84,77).flipHorizontally(),
				Sprite.fromImage("/images/arquero_arco.png").crop(112,13,84,77).flipHorizontally(),
				Sprite.fromImage("/images/arquero_arco.png").crop(200,13,84,79).flipHorizontally()));
	}

	@Override
	public void update(DeltaState deltaState) {
		this.getPlayer().move(10,0);
		if(this.getPlayer().getScene().getSoccerBall().getX() < this.getPlayer().getX())
			this.getPlayer().setState(new GoalkeeperWithoutBallMate(this.getGoalkeeper()));
	}

	@Override
	public boolean isWithBall() {
		return false;
	}

	@Override
	public boolean isRight() {
		return true;
	}

}
